from core.framework.HttpServer import HttpServer, ResquestHandler
from core.fuctions import  config_get,class_get
from core.pipelines.HttpServerPipeline import HttpServerPipeline

if __name__ == '__main__':

    #获取配置
    ROUTE = config_get('webapi','ROUTE')

    ROUTEEVENTS = {}
    for key in ROUTE:

        value = ROUTE[key]
        if key not in ROUTEEVENTS.keys():
            ROUTEEVENTS[key] = []

        for key2 in value:
            class2 = class_get(key2)
            ROUTEEVENTS[key].append(class2)

    HttpServerPipeline.ROUTEEVENTS = ROUTEEVENTS

    ResquestHandler.ACITON = HttpServerPipeline.handle

    print(HttpServerPipeline.ROUTEEVENTS)

    httpServer = HttpServer()
    httpServer.start()